package com.aman.nikoladespotoski;

import android.support.v7.util.DiffUtil;

/**
 * Created by Nikola on 8/17/2016.
 */

public class ProductListDiffCallback extends DiffUtil.Callback {
    @Override
    public int getOldListSize() {
        return 0;
    }

    @Override
    public int getNewListSize() {
        return 0;
    }

    @Override
    public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
        return false;
    }

    @Override
    public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
        return false;
    }
//    private List<Product> mOldList;
//    private List<Product> mNewList;
//
//    public ProductListDiffCallback(List<Product> oldList, List<Product> newList) {
//        this.mOldList = oldList;
//        this.mNewList = newList;
//    }
//
//    @Override
//    public int getOldListSize() {
//        return mOldList != null ? mOldList.size() : 0;
//    }
//
//    @Override
//    public int getNewListSize() {
//        return mNewList != null ? mNewList.size() : 0;
//    }
//
//    @Override
//    public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
//        return mNewList.get(newItemPosition).getProductId() == mOldList.get(oldItemPosition).getProductId();
//    }
//
//    @Override
//    public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
//        return mNewList.get(newItemPosition).equals(mOldList.get(oldItemPosition));
//    }
//
//    @Nullable
//    @Override
//    public Object getChangePayload(int oldItemPosition, int newItemPosition) {
//        Product newProduct = mNewList.get(newItemPosition);
//        Product oldProduct = mOldList.get(oldItemPosition);
//        Bundle diffBundle = new Bundle();
//        if (newProduct.hasDiscount() != oldProduct.hasDiscount()) {
//            diffBundle.putBoolean(KEY_DISCOUNT, newProduct.hasDiscount());
//        }
//        if (newProduct.getReviews().size() != oldProduct.getReviews().size()) {
//            diffBundle.putInt(Product.KEY_REVIEWS_COUNT, newProduct.getReviews().size());
//        }
//        if (newProduct.getPrice() != oldProduct.getPrice()) {
//            diffBundle.putFloat(Product.KEY_PRICE, newProduct.getPrice());
//        }
//        if (diffBundle.size() == 0) return null;
//        return diffBundle;
//    }
}